/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 combat_actor_action.cpp

	$Header: /heroes4/combat_actor_action.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "combat_actor_action.h"

#include <cassert>
#include "elements_of.h"
#include "enum_map.h"

// ------------------------------------------------------------------------------
// Unnamed namespace
// ------------------------------------------------------------------------------

namespace
{
	// ------------------------------------------------------------------------------
	// ------------------------------------------------------------------------------
	t_char_ptr_pair k_definitions[] =
	{
		{ k_combat_actor_action_block,		"block" },
		{ k_combat_actor_action_cast_spell,	"cast_spell" },
		{ k_combat_actor_action_die,		"die" },
		{ k_combat_actor_action_fidget,		"fidget" },
		{ k_combat_actor_action_flinch,		"flinch" },
		{ k_combat_actor_action_melee,		"melee" },
		{ k_combat_actor_action_melee_down,	"melee_down" },
		{ k_combat_actor_action_melee_up,	"melee_up" },
		{ k_combat_actor_action_postwalk,	"postwalk" },
		{ k_combat_actor_action_prewalk,	"prewalk" },
		{ k_combat_actor_action_ranged,		"ranged" },
		{ k_combat_actor_action_base_frame,	"base_frame" },
		{ k_combat_actor_action_wait,		"wait" },
		{ k_combat_actor_action_walk,		"walk" },
	};

	t_enum_map<t_combat_actor_action_id> k_map( k_definitions, 
		                                        ELEMENTS_OF( k_definitions ),
											    k_combat_actor_action_count,
												k_combat_actor_action_count );

} // Unnamed namespace

// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
std::string get_combat_actor_action_name( t_combat_actor_action_id action )
{
	return k_map[action];
}

t_combat_actor_action_id get_combat_action( std::string const& keyword )
{
	if (stricmp( keyword.c_str(), "stand" ) == 0)
		return k_combat_actor_action_base_frame;
	return k_map[keyword];
}

